<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<link href="../css/main.css" type="text/css" rel="stylesheet" />
		<link href="../css/dialog.css" rel="stylesheet" type="text/css">
		<script type="text/javascript" src="../datePicker/WdatePicker.js"></script>
		<title></title>
		<style type="text/css">
			textarea{width: 260px;height: 100px;border: #a6d9da solid 1px;padding: 5px;}
		</style>
	</head>
	<body>
		<div class="main_frame">
			<div class="position_div">
				<img src="../images/position_icon.png" />
				<i>售后中心</i><i>&gt;&gt;</i><i>工单管理</i>
			</div>
			<div class="right_div">
				<div class="search_div">					
					
					<div class="label_div">
						<label class="text_label">设备名称：</label>
						<input type="text" class="input_search" placeholder="" id="qry_device_name" />
					</div>
					<div class="label_div">
						<label class="text_label">工单编号：</label>
						<input type="text" class="input_search" placeholder="" id="qry_name" />
					</div>
		
					
					<div class="done_div">
						<button class="btn_common1 title_div2"  onclick="qryItemListBtn()">
							<i></i>搜索
						</button>
						
					</div>
                    <div class="cl">&nbsp;</div>
				</div>
				<table class="table_list">
					<tr>
						<th width="5%">序号</th>
						<th width="12%">工单编号</th>
						<th width="6%">类型</th>
						<th width="10%">工单描述</th>
						<th width="6%">工单状态</th>
						<th width="12%">设备名称</th>
						<th width="12%">维修人员</th>
						<th width="8%">客户</th>
						<th width="12%">创建时间</th>
						<th class="last_td">操作</th>
					</tr>
					<tbody id="listbox1">
					</tbody>
				</table>
				<div class="turn_page" style="display:none">
				   <div class="main_page" id="pageCon">
					   <a href="javascript:void(0)" class="first_a" id="firstPage"></a>
					   <a href="javascript:void(0)" class="up_a" id="prev"></a>    	
					   <a href="javascript:void(0)" class="next_a" id="next"></a>
					   <a href="javascript:void(0)" class="last_a" id="lastPage"></a>
					   <input id="page_num_input" style="width:40px;" type="text" onblur="checkValue(this);" onkeyup="value=value.replace(/\D/g,'')"/>
					   <button type="button" class="num_input" id="go_num_input">跳转</button>
					   <b class="page_text">当前<i><em id="nowpage"></em>/<em id="totalpage"></em></i>页，总数<i id="totalNum"></i>条</b>    	
				   </div>
				</div>
				
				
				
				
				
		
				
			</div>
		</div>
		
		<script type="text/javascript" src="../js/jquery-1.10.2.min.js"></script>
		<script type="text/javascript" src="../js/common.js"></script>
		<script type="text/javascript" src="../js/dialog.js"></script>
		<script type="text/javascript" src="../js/jquery-data.js"></script>
		<script type="text/javascript" src="../js/cookieUtil.js"></script>
		<script type="text/javascript">
			var yema=1;
			var pagelen=10;
			var totalPage=0; 
			var work_id  = 0;
			function qryList(){		
				qryItemList();
			}
			
			$(document).ready(function(){
				var  cookie_work_id = readCookie("workId_id");
				console.log(cookie_work_id);
				if(cookie_work_id){
					delCookie("workId_id");
					work_id = cookie_work_id;
				}
	
				qryList();
			});
			

			function qryList(){
				qryItemList();
			}
			function qryItemListBtn(){
				 yema=1;
				 work_id  = 0;
				qryItemList();
			}
			function qryItemList(){
				$.ajax({
					url: 'qryWorkOrderList', 
					type: 'POST',
					data:{orderNo:$("#qry_name").val(),
						deviceName:$("#qry_device_name").val(),
						id:work_id,
						yema:yema,length:pagelen},
					async: false,
					dataType: 'json', 
					timeout: 10000, 
					error: function(){LQWarn('请求失败,请稍后重试');}, 
					success: function(result){
						if(result.resultCode==1000){
							var items=result.returnObject.pageList;
							if (items && items.length > 0) {
								var rlist="";
								var item ;
								
								$.each(items,function(i){
									item = items[i];
									rlist+='<tr data-status ="'+ item.id+'"><td>'
										+ (i+1+length*(result.returnObject.curPage-1))
										+ '</td><td>' 
										+ item.orderNo
										+ '</td><td>' 
										+ (item.orderType == 1?"常规保养":"故障维修")
										+ '</td><td>' 
										+ replaceNull(item.description)
										+ '</td><td>' 
										+ (item.status == 1?"已派单":item.status == 2?"已接单":"已完成")
										+ '</td><td>' 
										+ replaceNull(item.deviceName)
										+'</td><td>'
										+ replaceNull(item.attendant)
										+'</td><td>'
										+ replaceNull(item.customerName)
										+'</td><td>'
										+ formatToDateTime(item.createTime)
										+'</td><td class="last_td">';
										/* if(item.status == 1)
										rlist +='<a class="mod" title="派单" href="javascript:void(0);" onclick="toEditForm(this)">派单</a>';
										//+ '<a class="del" title="删除" href="javascript:void(0);" onclick="delItem(this)">删除</a>'
										 */
										rlist += '</td></tr>';
								});
								$("#listbox1").html(rlist);
								totalPage=result.returnObject.totalPage;
								$("#nowpage").html(result.returnObject.curPage);
								$("#totalpage").html(totalPage);
								$("#totalNum").html(result.returnObject.totalNum);
								$(".turn_page").show();
							}else{
								$("#listbox1").html("");
								$(".turn_page").hide();
							}
						}
						else if(result.resultCode==1004){
							LQWarn(result.returnObject);
							window.top.location.href ="../login.jsp";
						}else{
							LQWarn(result.returnObject);
						}
					}
				});
			}
			
		
		</script>
	</body>
</html>
